package com.ruoyi.system.monitortask.controller;


import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.monitortask.domain.MonitorTaskGoods;
import com.ruoyi.system.monitortask.service.IMonitorTaskGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 账号监控任务关联商品表(monitor_task_goods)表控制层
 *
 * @author zyy
 * @date 2024-06-21 15:56:49
 */
@RestController
@RequestMapping("/monitorTaskGoods")
public class MonitorTaskGoodsController extends BaseController {
    /**
     * 服务对象
     */
    @Autowired
    private IMonitorTaskGoodsService monitorTaskGoodsService;


    /**
     * 通过监控任务查询
     */
    @GetMapping(value = "/getByTaskId")
    public TableDataInfo getInfo(Long monitorTaskId) {
        startPage();
        return getDataTable(monitorTaskGoodsService.getByMonitorTaskId(monitorTaskId));
    }

    /**
     * 新增数据(批量)
     *
     * @param monitorTaskGoods 实体对象
     * @return 新增结果
     */
    @Log(title = "MonitorTaskGoods", businessType = BusinessType.INSERT)
    @PostMapping("/addBatch")
    public AjaxResult addBatch(@RequestBody MonitorTaskGoods monitorTaskGoods) {
        return toAjax(monitorTaskGoodsService.addBatch(monitorTaskGoods));
    }

    /**
     * 删除数据
     *
     * @param ids 主键结合
     * @return 删除结果
     */
    @Log(title = "MonitorTaskGoods", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(monitorTaskGoodsService.deleteBatch(ids));
    }
}

